using System;
using System.Collections.Generic;
using System.Text;

namespace OracleInternal.Sharding
{
	internal abstract class ShardingKeys
	{
		internal virtual List<Tuple<OracleShardingKeyImpl, OracleShardingKeyImpl>> Keys
		{
			get;
			set;
		}

		internal virtual bool Contains(OracleShardingKeyImpl key)
		{
			return false;
		}

		internal virtual int CompareTo(ShardingKeys shardingKeys)
		{
			return 0;
		}

		public new static bool Equals(object objA, object objB)
		{
			if (objA == null && objB == null)
			{
				return true;
			}
			if (objA == null || objB == null)
			{
				return false;
			}
			if (!(objA is ShardingKeys) || !(objB is ShardingKeys))
			{
				return false;
			}
			return objA.Equals(objB);
		}

		public override string ToString()
		{
			List<Tuple<OracleShardingKeyImpl, OracleShardingKeyImpl>> keys = Keys;
			if (keys == null || keys.Count == 0)
			{
				return "[]";
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("[");
			foreach (Tuple<OracleShardingKeyImpl, OracleShardingKeyImpl> item in keys)
			{
				stringBuilder.Append("(");
				stringBuilder.Append(item.Item1.ToString());
				stringBuilder.Append(", ");
				stringBuilder.Append(item.Item2.ToString());
				stringBuilder.Append(")");
			}
			stringBuilder.Append("]");
			return stringBuilder.ToString();
		}
	}
}
